#!/usr/bin/perl

use DateTime;
use strict;

# Clean up the log files by organising them.
my $rdir = "/data/MENTOK_2/ste616/EB500/Software/Utilities/TCPExample";

# Clean up two days ago.
my $dt = DateTime->now;
$dt->subtract( days => 2 );

my $olddir_search = "".($dt->year)."-".($dt->month)."-".($dt->day);

my $clean1_mcmd = "mkdir ".$rdir."/old_sweeps/".$olddir_search;
print $clean1_mcmd."\n";
system $clean1_mcmd;
my $clean1_cmd = "mv ".$rdir."/".$olddir_search."T* ".$rdir."/old_sweeps/".$olddir_search."/";
print $clean1_cmd."\n";
system $clean1_cmd;

my $clean2_mcmd = "mkdir ".$rdir."/old_spectra/".$olddir_search;
print $clean2_mcmd."\n";
system $clean2_mcmd;
my $clean2_cmd = "mv ".$rdir."/spectra/rfispectrum_".$olddir_search."T* ".$rdir."/old_spectra/".$olddir_search."/";
print $clean2_cmd."\n";
system $clean2_cmd;
